package oa.service.impl;

import java.util.List;

import oa.dao.UserDao;
import oa.dao.impl.UserDaoImpl;
import oa.entity.User;
import oa.exception.DaoException;
import oa.service.UserService;

public class UserServiceImpl implements UserService {
	UserDao userDao = new UserDaoImpl();
	@Override
	public User userLogin(String name, String pwd) {
		return userDao.userLogin(name, pwd);
	}

	@Override
	public boolean addUser(User user) throws DaoException {
		return userDao.addUser(user);
	}

	@Override
	public List<User> selectAllUser(User user,Integer pageNo, Integer row) {
		try {
			return userDao.selectAllUser(user, pageNo, row);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<User> selectUser(int userId, String userName, int deptId,int... companyId) {
		try {
			return userDao.selectUser(userId, userName, deptId,companyId);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public boolean updateUser(User user) throws DaoException {
		return userDao.updateUser(user);
	}

	@Override
	public boolean deleteUser(int userId) {
		try {
			return userDao.deleteUser(userId);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
	
	@Override
	public int selectAllUserCount(int deptid,int companyid) throws DaoException {
		return userDao.selectAllUserCount(deptid,companyid);
	}

	@Override
	public boolean updateUserFuZe(User user) throws DaoException {
		return userDao.updateUserFuZe(user);
	}

}
